package com.iskny.framework.kit;

import java.util.List;

import com.iskny.framework.model.Menu;
import com.iskny.framework.model.MenuBean;
import com.jfinal.plugin.ehcache.CacheKit;
import com.jfinal.plugin.ehcache.IDataLoader;

/**
 * 
 * @author 伟强
 *
 */
public class UserMenusKit {
	private final static Menu dao = Menu.dao;
    private final static String cacheName = "UserMenus";

    public UserMenusKit(){
    }
    /**
     * 根据用户id返回菜单信息
     * @param id
     * @return
     */
    public static List<MenuBean> loadMenus(long id) {
        final long ID = id;
        return CacheKit.get(cacheName, ID, new IDataLoader() {
            @Override
            public Object load() {
                return dao.findMenuBeansByUserid(ID);
            }
        });
    }
}
